package cn.itlaobing.web.dao;

import cn.itlaobing.web.util.JdbcPramarter;
import com.alibaba.druid.pool.DruidDataSource;

import javax.sql.DataSource;

public class BaseDao {
    private DataSource dataSource=null;
    protected DataSource getDataSource(){
        if(dataSource!=null){
            return dataSource;
        }
        DruidDataSource druidDataSource=new DruidDataSource();
        druidDataSource.setDriverClassName(JdbcPramarter.DRIVER);
        druidDataSource.setUrl(JdbcPramarter.URL);
        druidDataSource.setUsername(JdbcPramarter.USER);
        druidDataSource.setPassword(JdbcPramarter.PWD);
        this.dataSource=druidDataSource;
        return dataSource;
    }
}
